package com.huaxonline.boot.demo.controller;


import com.huaxonline.boot.demo.dto.DemoDTO;
import com.huaxonline.boot.demo.dto.DemoParam;
import com.huaxonline.boot.demo.service.IDemoService;
import com.huaxonline.boot.log.WebLogAnnotation;
import com.huaxonline.boot.web.pojo.response.QR;
import com.huaxonline.boot.web.pojo.response.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhaoshulei
 * @since 2020-05-08
 */
@RestController
@RequestMapping("/demo")
@Slf4j
@Tag(name = "Demo 接口", description = "演示接口示例")
public class DemoController {
    @Autowired
    private IDemoService iDemoService;

    @GetMapping("/query")
    @Operation(summary = "获取demo列表", description = "返回所有 Demo 数据")
    @WebLogAnnotation
    public R getAllList() {
        return R.ok(iDemoService.getAllList());
    }

    @GetMapping("/page")
    @Operation(summary = "分页查询demo列表", description = "分页条件查询 Demo 数据")
    @WebLogAnnotation
    public QR<DemoDTO> getPageList(DemoParam demoParam) {
        return QR.ok(iDemoService.getPageList(demoParam));
    }
}
